﻿using _111.Models;
using Microsoft.AspNetCore.Mvc;
using MyDapperApi.Models;
using MyDapperApi.Services;
using QYWXUpdate.DataModel;
using QYWXUpdate.DataModel.QueueFront;

namespace MyDapperApi.Controllers;

[ApiController]
[Route("api/[controller]")]
public class QueueFrontController : ControllerBase
{
    private readonly IQueueFrontService _queueService;

    public QueueFrontController(IQueueFrontService queueService)
    {
        _queueService = queueService;
    }

    [HttpPost("AddQueue")]
    public async Task<IActionResult> AddQueue([FromBody] AddQueueFrontRequest request)
    {
        var users = await _queueService.AddQueue(request);
        return Ok(users);
    }

    [HttpPost("PagingQueueByConsumer")]
    public async Task<IActionResult> PagingQueueByConsumer([FromBody] PagingQueueFrontByConsumerRequest request)
    {
        var users = await _queueService.PagingQueueByConsumer(request);
        return Ok(users);
    }

    [HttpGet("DeleteQueue")]
    public async Task<IActionResult> DeleteQueue([FromQuery] DelQueueFrontRequest request)
    {
        var users = await _queueService.DeleteQueueCode(request);
        return Ok(users);
    }

    [HttpGet("PagingQueue")]
    public async Task<IActionResult> PagingQueue([FromQuery] PagingQueueFrontRequest request)
    {
        var users = await _queueService.PagingQueue(request);
        return Ok(users.data);
    }

    [HttpGet("PagingQueueForBoard")]
    public async Task<IActionResult> PagingQueueForBoard([FromQuery] PagingQueueFrontRequest request)
    {
        var users = await _queueService.PagingQueueForBoard(request);
        return Ok(users.data);
    }

    [HttpGet("PagingQueueDetail")]
    public async Task<IActionResult> PagingQueueDetail([FromQuery] PagingQueueDetailRequest request)
    {
        var users = await _queueService.PagingQueueDetail(request);
        return Ok(users.data);
    }

    [HttpGet("Asking")]
    public async Task<IActionResult> Asking([FromQuery] IdRequest request)
    {
        var users = await _queueService.Asking(request);
        return Ok(users.data);
    }

    [HttpGet("Keep")]
    public async Task<IActionResult> Keep([FromQuery] IdRequest request)
    {
        var users = await _queueService.Keep(request);
        return Ok(users.data);
    }

    [HttpPost("GetUser")]
    public async Task<IActionResult> GetUser([FromBody] IdRequest request)
    {
        var user = new FrontGetUserRequest()
        {
            AppId = "wxc06d9725ce3431a2",
            Code = request.Id
        };
        var users = await _queueService.GetUser(user);
        return Ok(users.data);
    }

    [HttpPost("CheckFollowStatus")]
    public async Task<IActionResult> CheckFollowStatus([FromBody]IdRequest request)
    {
        var users = await _queueService.CheckFollowStatus(request);
        return Ok(users);
    }


}